home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / amigae.july.archive / 000048_crash!UNCA.EDU!JVANRIPER_Thu, 22 Jul 93 07:42:00 PST.msg < prev    next >
Text File  |  1993-08-31  |  2KB  |  69 lines

  1. Received: by bkhouse.cts.com (V1.16/Amiga)
  2.     id AA00000; Thu, 22 Jul 93 07:42:00 PST
  3. Received: from uncavx by crash.cts.com with smtp
  4.     (Smail3.1.28.1 #15) id m0oJ0Mz-00007MC; Thu, 22 Jul 93 06:07 PDT
  5. Received: from UNCA.EDU by UNCA.EDU (PMDF V4.2-11 #3902) id
  6.  <01H0U5F9AFAU8WWJLH@UNCA.EDU>; Thu, 22 Jul 1993 09:04:22 EDT
  7. Date: Thu, 22 Jul 1993 09:04:21 -0400 (EDT)
  8. Message-id: <01H0U5F9AFAW8WWJLH@UNCA.EDU>
  9. Organization: University of North Carolina at Asheville
  10. X-VMS-To: IN%"amigae@bkhouse.cts.com"
  11. MIME-version: 1.0
  12. Content-type: TEXT/PLAIN; CHARSET=US-ASCII
  13. Content-transfer-encoding: 7BIT
  14. From: "Joseph E. Van_Riper III" <JVANRIPER@UNCA.EDU>
  15. To: amigae@bkhouse.cts.com
  16. Subject: Re: Help with datestamps
  17.  
  18.  
  19. I think he typed something like:
  20.  
  21. ----8<----8<----
  22.  
  23. MODULE 'dos/dos', 'dos/datetime'
  24.  
  25. PROC main()
  26.  
  27. DEF date : PTR TO datetime,
  28.  
  29.     s[10] : ARRAY OF CHAR
  30.  
  31.     date := New(SIZEOF datetime)
  32.     date.stamp := New(SIZEOF datestamp)
  33.     date.stamp := DateStamp(date.stamp) /*If doing it this way, try*/
  34.     date.strdate := s                  /* just 'DateStamp(date.stamp)'*/
  35.     DateToStr(date)                    /* without the assignment.*/
  36.     WriteF('date: \s\n',s)
  37.  
  38. ENDPROC
  39.  
  40. ----8<----8<----
  41. I tried something like this, too, and found it didn't work.
  42.  
  43. I think the reason why is E doesn't know that date.stamp is supposed to be of
  44. object datestamp, so when you try to date.stamp:=DateStamp(date.stamp), it
  45. fails.  The following code has worked very well for me:
  46.  
  47.  
  48. PROC whatever()
  49.  DEF dt:datetime 
  50.   DateStamp(dt.stamp)
  51.   dt.format:=FORMAT_DOS /* set datetime options */
  52.   dt.flags:=0
  53.   dt.strday:=String(10)
  54.   dt.strdate:=String(10)
  55.   dt.strtime:=String(10)
  56.   DateToStr(dt)         /* make into string */
  57.  
  58. /*whatever*/
  59.  
  60. ENDPROC
  61.  
  62. You can Dispose() of dt.strday/dt.strdate/dt.strtime if you want to keep from
  63. losing room (say, in a program that will be calling on this routine fairly
  64. regularly for a good while).  For the program I'm working on, however, this was
  65. adequate.
  66.  
  67. Hope it's helpful.
  68.  
  69. - Trey